package com.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dao.OrdersDao;
import com.entity.Cartltem;
import com.entity.Orders;
@Service
public class OrdersService {
	@Resource
	private OrdersDao od;
	@Transactional
	public int orders(int desk,Orders order){
		int oid=-1;
		Orders o=od.finDeskOrders(desk);
		if(o==null){
			oid=od.creationOrders(desk, order);
		}else{
			oid=o.getId();
		}
		return oid;
	}
	
	public List<Cartltem> finall(int orders_id){	
		return od.finall(orders_id);
	}
	@Transactional
	public boolean pushOrder(int orders_id){
		Orders order=od.finOrders(orders_id);
		return od.pushOrders(order);
	}
}
